import React, { Component } from 'react'
import store from '../store'

export default class App extends Component {
  render() {
    // console.log(store);
    console.log(store.getState());
    let action = {
      type: 'add',
      payload: {
        step:1
      }
    }
    let unsubscribe = store.subscribe(function (res) {
      console.log('仓库发生变化',res);
    })
    unsubscribe()
    store.dispatch(action)
    console.log(store.getState());
    return (
      <div>
        <button onClick={this.props.add}>+</button>
        <span>{this.props.num}</span>
        <button onClick={this.props.sub}>-</button>
      </div>
    )
  }
}


